def proverka(x):
   stc = []
   for l in x:
      
      if l == "[" or l == "{" or l == "(" or l == "<":
         stc.append(l)
      else:
         if len(stc) == 0:
            return False
         else:
            if stc[-1] == '[' and l ==']' or stc[-1] == '{' and l =='}' or stc[-1] == '(' and l == ')' or stc[-1] == '<' and l == '>':
              stc.pop()
   if len(stc) == 0:
      return True
   
   return False

print(proverka(input("введите скобочную последовательность:")))
